// pages/bindphone/bindphone.js
var app = getApp()
Page({

  /**
   * 页面的初始数据
   */
  data: {

  },

  getPhoneNumber (e) {
    wx.request({
      url: app.globalData.baseUrl + '/user/bindPhone',
      data: {
        xcxOpenId: app.globalData.xcxOpenId,
        iv: e.detail.iv,
        encryptedData:e.detail.encryptedData
      },
      method:'post',
      header: {
        'content-type': 'application/x-www-form-urlencoded' // 默认值
      },
      success:function(res){
        if (res.data.code == 0) {
          wx.reLaunch({
            url: '../me/me',
          })
        }else if(res.data.code==999999) {
          wx.reLaunch({
            url: '../me/me',
          })
        }else{
          // Toast(res.msg);
          wx.showToast({
            title: 'res.msg',
            icon: 'none'
          })
        }
      }
    })
  },
  back(){
    wx.reLaunch({
      url: '../me/me',
    })
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {

  }
})